package method;

public class MethodDemo5 {
    public static void main(String[] args) {
        System.out.println("sum(10,20) = " + sum(10, 20));
        System.out.println("sum(10,20) = " + sum(10.15, 20));
    }

    public static int sum(int a, int b) {
        System.out.println("int +int");
        return a + b;
    }

    //与返回值类型无关
//    public static void sum(int a,int b){
//        System.out.println(a + b);
//    }
    //形参个数不同
    public static int sum(int a, int b, int c) {
        System.out.println("int + int + int");
        return a + b + c;
    }

    //类型不同
    public static double sum(double a, double b) {
        System.out.println("double + double");
        return a + b;
    }

    //    //类型顺序不同
    public static double sum(int a, double b) {
        System.out.println("int + double");
        return a + b;
    }

    public static double sum(double a, int b) {
        System.out.println("double + int");
        return a + b;
    }
}
